package com.itheima.employee.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.itheima.employee.pojo.EmployeeArchive;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 数据访问接口
 */
public interface ArchiveMapper extends BaseMapper<EmployeeArchive>{


    //@Query(value = "SELECT * FROM em_archive WHERE company_id = ?1 AND month LIKE ?2 GROUP BY month HAVING MAX(create_time) limit ?3,?4", nativeQuery = true)
    List<EmployeeArchive> findAllData(@Param("companyId") String companyId, @Param("year") String year, @Param("index") Integer index, Integer pagesize);

    //@Query(value = "SELECT count(DISTINCT month) FROM em_archive WHERE company_id = ?1 AND month LIKE ?2", nativeQuery = true)
    long countAllData(String companyId, String year);

    List<EmployeeArchive> findSearch(@Param("year") String year, @Param("companyId") String companyId);
}